public class Leet65 {
    public static void main(String[] args) {
        Leet65 l = new Leet65();
        System.out.println(l.isNumber("+"));
    }
    public boolean isNumber(String s) {
        char[] chs = s.toCharArray();
        if (chs[0]=='+'||chs[0]=='-'||(chs[0]>='0'&&chs[0]<='9')){
            for (int i = 1; i < chs.length; i++) {
                char ch = chs[i];
                if (isNum(ch))
                    continue;
                if (isJJ(ch)){
                    if (isE(chs[i-1])&&isNum(chs[i+1]))
                        continue;
                    else return false;
                }
                if (ch=='.'){
                    if(isNum(chs[i-1])&&isNum(chs[i+1]))
                        continue;
                    else return false;
                }
                return false;
            }
            return true;
        }else return false;
    }
    boolean isNum(char ch){
        return ch >= '0' && ch <= '9';
    }
    boolean isE(char ch){
        return ch == 'e' || ch == 'E';
    }
    boolean isJJ(char ch){
        return ch == '+' || ch == '-';
    }
}
